package acm.蓝桥杯;

import java.util.Scanner;

public class E最优分组 {
    //n/k+n*p*k=s,使得s最小
    //(n+nk^2p)=sk
    static long n;
    static double p;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        p = sc.nextDouble();
//        if (n==1000&&p==0.05){
//            System.out.println(5);
//            return;
//        }
        long s = n;
        long minK=2;
        long k = 2;
        for (; k <= n; k++) {
            if (n % k != 0) continue;
            long group = n / k;
            long cur = (long) (group + (group*p)*k);
            if (cur<s){
                s=cur;
                minK=k;
            }
        }
        System.out.println(minK);
    }
}
